<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('team/team_list')}">团队列表</a></li>
        <li><a href="{:url('team/add')}">添加成员</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('Team/team_list')}">
        用户名:
        <input type="text" class="form-control" name="user_name" style="width: 120px;" value="{:input('request.user_name/s','')}" placeholder="请输入{:lang('USERNAME')}">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('Team/team_list')}">清空</a>
    </form>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th width="50">ID</th>
            <th>姓名</th>
            <th>头像</th>
            <th>职位描述</th>
            <th>律所地址</th>
            <th>状态</th>
            <th width="140">{:lang('ACTIONS')}</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="teams" item="vo">
            <tr>
                <td>{$vo.id}</td>
                <td>{$vo.user_name}</td>
                <td>
                    <a href="javascript:parent.imagePreviewDialog('{:cmf_get_image_preview_url($vo.portrait)}');">
                        <i class="fa fa-photo fa-fw"></i>
                    </a>
                </td>
                <td>{$vo.position}</td>
                <td>{$vo.address}</td>
                <td>
                    <switch name="vo.status">
                        <case value="2">
                            <span class="label label-danger">异常</span>
                        </case>
                        <case value="1">
                            <span class="label label-success">正常</span>
                        </case>
                    </switch>
                </td>
                <td>

                        <a class="btn btn-xs btn-primary" href='{:url("team/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
                    <a class="btn btn-xs btn-primary" href="#" onclick="zhiding({$vo.id})" >置顶</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('team/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__TMPL__/public/assets/js/layer/layer.js"></script>
<script>
    function zhiding(id){
        $.ajax({
            type: 'POST',
            url: "{:url('admin/team/top')}",
            data:{id:id},
            success: function(data){
                if(data==1){
                    layer.msg('置顶成功',{icon:1,time:2000});
                    setTimeout(function () {
                        location.reload();
                    },2000)

                }else{
                    layer.msg('置顶失败',{icon:5,time:2000});
                    setTimeout(function () {
                        location.reload();
                    },2000)

                }
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    }
</script>
</body>
</html>